package com.healthy.service;

import com.healthy.entity.Knowledgevaset;
import com.healthy.mapper.KnowledgevasetMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class KnowledgevasetService {

    @Autowired
    KnowledgevasetMapper knowledgevasetMapper;

    //    查询全部
    public List<Knowledgevaset> cuList() {
        return knowledgevasetMapper.culist();
    }

    //    添加
    public Knowledgevaset cuInsert(Knowledgevaset knowledgevaset) {

        knowledgevasetMapper.cuInsert(knowledgevaset);
        return knowledgevaset;
    }

    //    删除
    public int cuDeleteByid(int id) throws Exception {
        int res = knowledgevasetMapper.cuDeleteByid(id);
        if (res > 0) {
            return 1;
        } else {
            return 0;
        }
    }
    //    修改
    public int cuUpdateByid(int id,String type,String open) throws Exception {
        int res = knowledgevasetMapper.cuUpdateByid(id,type,open);
        if (res > 0) {
            return 1;
        } else {
            return 0;
        }
    }
}
